<HTML><HEAD><TITLE>string_list(?String, ?List)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Strings and Atoms</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>string_list(?String, ?List)</H1>
Succeeds if List is a list whose elements are the ascii codes of the
characters of String.


<DL>
<DT><EM>String</EM></DT>
<DD>String or variable.
</DD>
<DT><EM>List</EM></DT>
<DD>List of integers (in the range 0 to 255) and/or variables,                or else a variable.
</DD>
</DL>
<H2>Description</H2>
   This predicate performs conversion between a string and a list of the
   ASCII codes of the characters of the string.

<P>
   If String is instantiated, unifies List with the list whose elements are
   the ASCII codes for the elements of the string.

<P>
   If List is instantiated, unifies String with the string corresponding to
   this list of ASCII codes.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>string_list(+, -) is det
<LI>string_list(-, +) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>String is neither a string nor a variable.
<DT><EM>(5) type error </EM>
<DD>List is neither a list nor a variable.
<DT><EM>(6) out of range </EM>
<DD>One (or more) elements of List are not integers in the range    0 to 255.
<DT><EM>(4) instantiation fault </EM>
<DD>Neither String or List are ground (non-coroutine mode only).
</DL>
<H2>Examples</H2>
<PRE>
   Success:
   string_list(S,[65,98,99]).          (gives S="Abc").
   string_list("abc",L).               (gives L=[97,98,99]).
   string_list("abc",[97,A,99]).       (gives A=98).
   string_list(S,[127]).               (gives S="").
   string_list("abc",[97|A]).          (gives A=[98,99]).
   Fail:
   string_list("abc",[98,99,100]).
   Error:
   string_list(S,[A|[128]]).           (Error 4).
   string_list(S,[1|A]).               (Error 4).
   string_list('string',L).            (Error 5).
   string_list(S,"list").              (Error 5).
   string_list('string',[128]).        (Error 5).
   string_list(S,["B"]).               (Error 5).
   string_list(S,[256]).               (Error 6).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/stratom/string_code-3.html">string_code / 3</A>, <A HREF="../../kernel/stratom/string_list-3.html">string_list / 3</A>, <A HREF="../../kernel/stratom/atom_string-2.html">atom_string / 2</A>, <A HREF="../../kernel/termmanip/char_code-2.html">char_code / 2</A>, <A HREF="../../kernel/termmanip/term_string-2.html">term_string / 2</A>, <A HREF="../../kernel/stratom/split_string-4.html">split_string / 4</A>
</BODY></HTML>
